﻿// <copyright file="LogView.cs" company="Ecole Normale Supérieure">
// Released under GPLv2
// </copyright>
// <summary>Contains the LogView class.</summary>

namespace Sqwarea.GameLogic.View
{
    using System;
    using System.Drawing;
    using Sqwarea.Persistence;

    /// <summary>
    /// Class for a view of a log.
    /// Used by LogView to provide just needed information to GUI.
    /// </summary>
    public class LogView
    {
        /// <summary>
        /// Initializes a new instance of the LogView class
        /// </summary>
        /// <param name="log">The log you wanna see.</param>
        /// <param name="cache">Kings cache to get the king.</param>
        public LogView(Log log, IKingsCache cache)
        {
            this.Kind = log.Kind;
            this.Position = log.Position;
            this.Date = log.Date;
            this.OtherKingNickname = cache.GetKingById(log.OtherKingId).Nickname;
        }

        /// <summary>
        /// Gets the log event kind.
        /// </summary>
        public LogKind Kind { get; private set; }

        /// <summary>
        /// Gets the other king involved, if not the it is 0.
        /// </summary>
        public string OtherKingNickname { get; private set; }

        /// <summary>
        /// Gets the square concerned by the log event
        /// </summary>
        public Point Position { get; private set; }

        /// <summary>
        /// Gets the date at which the log has been emitted
        /// </summary>
        public DateTimeOffset Date { get; private set; }
    }
}
